<?php

namespace api\user\controller;

class AdminFeedbackController extends \Aaa\user\controller\AdminFeedbackController {

    protected function init() {
        $this->baseField = [
            [
                'field' => 'id',
                'name' => 'ID',
            ],
            [
                'field' => 'type',
                'name' => '类型',
                'type' => 'select',
                'options' => [
                    ['name' => '咨询', 'value' => 1],
                    ['name' => '投诉', 'value' => 2],
                    ['name' => '建议', 'value' => 3],
                ],
            ],
            [
                'field' => 'user_id',
                'name' => '用户',
            ],
            [
                'field' => 'create_time',
                'name' => '提交时间',
                'type' => 'time',
            ],
            [
                'field' => 'content',
                'name' => '问题',
                'type' => 'textarea',
            ],
            [
                'field' => 'replied',
                'name' => '回复状态',
                'type' => 'switch',
                'options' => ['已回复', '未回复'],
            ],
            [
                'field' => 'reply',
                'name' => '回复',
                'type' => 'textarea',
            ],
            [
                'field' => 'reply_time',
                'name' => '回复时间',
                'type' => 'time',
            ],
        ];
    }

    protected function beforeIndex() {
        $this->actionField = ['id', 'type', 'user_id', 'create_time', 'content', 'replied', 'reply', 'reply_time',];
        $this->searchField = [
            'common' => [
                'id' => 'accurate',
                'type' => 'accurate',
                'user_id' => 'accurate',
                'content' => 'fuzzy',
                'replied' => 'accurate',
                'reply' => 'fuzzy',
            ],
            'time' => ['create_time', 'reply_time'],
        ];
    }

    protected function beforeEdit() {
        $this->actionField = [ 'type',  'content', 'replied', 'reply',];
    }

    protected function beforeReply() {
        $this->actionField = [ 'content',  'reply',];
    }

}